package com.itheima.api.ordersetting;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.mapper.ordersetting.OmsOrderSettingMapper;
import com.itheima.vo.pojo.OmsOrderSetting;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

@DubboService
public class OmsOrderSettingServiceImpl extends ServiceImpl<OmsOrderSettingMapper, OmsOrderSetting> implements OmsOrderSettingService {

    @DubboReference
    private OmsOrderSettingService orderSettingService;

    @Autowired
    private OmsOrderSettingMapper orderSettingMapper;


    /**
     * 修改指定订单设置
     *
     * @param id
     * @param setting
     */
    public void updateSetting(Integer id, OmsOrderSetting setting) {
        //创建条件构造器
        LambdaUpdateWrapper<OmsOrderSetting> lqw = new LambdaUpdateWrapper<>();
        lqw.eq(id != null, OmsOrderSetting::getId, id);
        orderSettingMapper.update(setting, lqw);
    }
}
